package com.tom.mybatis.executor;

import com.tom.mybatis.config.Configuration;
import com.tom.mybatis.config.MapperRegistory;
import com.tom.mybatis.statement.StatementHandler;

/**
 * @author : tom
 * @project: tom-mybatis
 * @date : 2018/11/7 15:03
 */
public class SimpleExecutor implements Executor {

    private Configuration configuration;

    public SimpleExecutor(Configuration configuration) {
        this.configuration = configuration;
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public void setConfiguration(Configuration configuration) {
        this.configuration = configuration;
    }

    public <T> T query(MapperRegistory.MapperDate mapperData, Object parameter) throws Exception {
        StatementHandler handler=new StatementHandler(configuration);
        return (T)handler.query(mapperData,parameter);
    }
}
